//使用try-with-resource

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class tryWithResource {
    public static void main(String[] args) {
        try(FileReader reader = new FileReader("D:/a.txt");) {
            char c1 = (char)reader.read();
            char c2 = (char)reader.read();
            char c3 = (char)reader.read();
            System.out.println(""+c1+c2+c3);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
